import { NativeHelper } from "../../native/NativeHelper";
import { IRecordAble } from "../IRecordAble";


export class NativeRecorder extends IRecordAble{
    
    protected _className:string = "sdk.{0}.Record";

    init(type: string): IRecordAble {
        if(!this._type){
            this._type = type;
            this._className = this._className.replace("{0}", this._type);
        }
        return this;
    }

    startRecord(duration?: number, frameRate?: number): void {
        NativeHelper.call(this._className, "startRecord", duration, frameRate);
    }
    stopRecord(): void {
        NativeHelper.call(this._className, "stopRecord");
    }
    pauseRecord(): void {
        NativeHelper.call(this._className, "pauseRecord");
    }
    resumeRecord(): void {
        NativeHelper.call(this._className, "resumeRecord");
    }

    get videoPath(): string {
        return NativeHelper.callWithReturnType(this._className, "resumeRecord", "") as string;
    }

}
